package com.aspose.cells.a.d;

public class zgi {
   public static zcv a(zft var0, String var1) throws Exception {
      com.aspose.cells.b.a.d.zh var3 = new com.aspose.cells.b.a.d.zh();

      byte[] var2;
      try {
         var0.a(var3, true, false);
         var2 = com.aspose.cells.a.c.zw.a(var3, false);
      } finally {
         if (var3 != null) {
            var3.a();
         }

      }

      return a(var2, var1);
   }

   private static zcv a(byte[] var0, String var1) throws Exception {
      byte[] var2 = b(var0, var1);
      zcv var3 = new zcv(var1, "application/vnd.ms-package.obfuscated-opentype");
      var3.d().b(var2, 0, var2.length);
      return var3;
   }

   private static byte[] b(byte[] var0, String var1) throws Exception {
      byte[] var2 = a(var1);

      for(int var3 = 0; var3 < 32; ++var3) {
         int var4 = var2.length - var3 % var2.length - 1;
         var0[var3] ^= var2[var4];
      }

      return var0;
   }

   private static byte[] a(String var0) throws Exception {
      String var1 = com.aspose.cells.b.a.d.zk.c(var0);
      String var2 = (new com.aspose.cells.b.a.zh(var1)).a("N");
      byte[] var3 = new byte[16];

      for(int var4 = 0; var4 < var3.length; ++var4) {
         var3[var4] = (byte)com.aspose.cells.a.c.zp.c(var2.substring(var4 * 2, var4 * 2 + 2));
      }

      return var3;
   }
}
